﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;
using CameraWrapper;

namespace TestUI
{
    public partial class Camera3TestCameraWrapper : Form
    {
        SDK10000 camwrap;
        SDK10000.CameraInfo cam1, cam2, cam3;

        public Camera3TestCameraWrapper()
        {
            InitializeComponent();
        }

        private void CameraTest_Load(object sender, EventArgs e)
        {
            cam1 = new SDK10000.CameraInfo(pictureBox1, "194.36.79.201", "D:\\cam1.avi");
            cam2 = new SDK10000.CameraInfo(pictureBox2, "194.36.79.202", "D:\\cam2.avi");
            cam3 = new SDK10000.CameraInfo(pictureBox3, "194.36.79.203", "D:\\cam3.avi");
            camwrap = new SDK10000(cam1, cam2, cam3);

            if (camwrap.Connect()) label1.Text = "Video server is connected.";
            else label1.Text = ("Can not connect to video server");

            camwrap.Play();
        }

        private void butRecord_Click(object sender, EventArgs e)
        {
            camwrap.StartRecord();
        }

        private void butStop_Click(object sender, EventArgs e)
        {
            camwrap.StopRecord();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (cam1.IsPlaying) camwrap.Pause(cam1);
            else camwrap.Play(cam1);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            camwrap.Play(cam1);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            camwrap.Pause(cam1);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            camwrap.Stop(cam1);
        }
    }
}